package cc.ufinity.networkdiagnose.manager;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;

public class Draw extends View {
	private Paint paint;
	private WiFiApInfo wifiA;//移动
	private WiFiApInfo wifiB;//电信
	private WiFiApInfo wifiC;//联通
	private int X;
	private int Z;
	private int Y;
	Paint paintX;
	Paint paintY;
	Paint paintZ;

	public Draw(Context context, WiFiApInfo A, WiFiApInfo B, WiFiApInfo C) {
		super(context);
		paint = new Paint();
		paint.setColor(Color.GREEN);
		paintX=new Paint();
		paintX.setColor(Color.RED);
		paintX.setTextSize(20);
		paintY=new Paint();
		paintY.setColor(Color.GREEN);
		paintY.setTextSize(20);
		paintZ=new Paint();
		paintZ.setColor(Color.BLUE);
		paintZ.setTextSize(20);
		this.wifiA = A;
		this.wifiB = B;
		this.wifiC = C;
	}

	@Override
	protected void onDraw(Canvas canvas) {
		// TODO Auto-generated method stub
		super.onDraw(canvas);
		canvas.drawLine(30, 0, 30, 200, paint);
		canvas.drawLine(30, 200, 500, 200, paint);
		
		X= wifiA.getLEVEl()*(-2);//移动
		Y=wifiB.getLEVEl()*(-2);//电信
		Z=wifiC.getLEVEl()*(-2);//联通
		//canvas.drawRect(left, top, right, bottom, paint)
		canvas.drawText("-100", 10, 200, paint);
		canvas.drawText("-50", 10, 100, paint);
		canvas.drawRect(80, X, 130, 200, paintX);
		canvas.drawText("中国移动", 60, 240, paintX);
		canvas.drawRect(180, Y, 230, 200, paintY);
		canvas.drawText("中国电信", 160, 240, paintY);
		canvas.drawRect(280, Z, 330, 200, paintZ);
		canvas.drawText("中国联通", 260, 240, paintZ);
	}
}
